package com.bilin.coin.network;

import androidx.annotation.NonNull;

import com.bilin.coin.network.builder.BitmapBuilder;
import com.bilin.coin.network.builder.FileBuilder;
import com.bilin.coin.network.builder.GetBuilder;
import com.bilin.coin.network.builder.PostBuilder;
import com.bilin.coin.network.builder.PostJsonBuilder;
import com.bilin.coin.network.builder.PostXmlBuilder;
import com.bilin.coin.network.builder.UpDateFileBuilder;
import com.bilin.coin.network.builder.UpDateFileBuilder2;
import com.bilin.coin.network.builder.WebSocketBuilder;
import com.google.gson.Gson;


/**
 * Created by Administrator on 2018/3/27.
 */

public class RequestUtils {

    private static Gson mGson;

    public static Gson getGson()
    {
        if(mGson==null){
            synchronized (Gson.class){
                mGson=new Gson();
            }
        }
        return mGson;
    }


    @NonNull
    public static GetBuilder get(){
        return new GetBuilder();
    }

    @NonNull
    public static GetBuilder get(String baseUrl){
        return new GetBuilder(baseUrl);
    }

    @NonNull
    public static PostBuilder post(){
        return new PostBuilder();
    }

    @NonNull
    public static PostBuilder post(String baseUrl){
        return new PostBuilder(baseUrl);
    }

    @NonNull
    public  static <T> PostJsonBuilder postJson(T param){
        return new PostJsonBuilder(param);
    }

    @NonNull
    public  static  PostJsonBuilder postJson(String paramJson,String baseUrl){
        return new PostJsonBuilder(paramJson,baseUrl);
    }

    @NonNull
    public  static PostXmlBuilder postXml(String param){
        return new PostXmlBuilder(param);
    }

    @NonNull
    public  static  PostXmlBuilder postXml(String xml,String baseUrl){
        return new PostXmlBuilder(xml,baseUrl);
    }

    @NonNull
    public static BitmapBuilder getBitmap(){
        return new BitmapBuilder();
    }
    @NonNull
    public static FileBuilder getFile(){
        return new FileBuilder();
    }
    @NonNull
    public static WebSocketBuilder getWebSocket(){
        return new WebSocketBuilder();
    }
    @NonNull
    public static UpDateFileBuilder getUpDateFile(){
        return new UpDateFileBuilder();
    }

    @NonNull
    public static UpDateFileBuilder2 getUpDateFile2(){
        return new UpDateFileBuilder2();
    }

}
